<template>
    <div id="nav">

        <div id="nav_son">
            <div class="left">
                <router-link custom :to="item.link" v-slot="{ isActive, navigate }" v-for="item in store.navbarList"
                    :key="item">
                    <li :class="isActive ? 'active' : ''" @click="navigate">{{ item.name }}</li>
                </router-link>
            </div>

            <div class="right">
                <ul>
                    <router-link custom to="/Allin/login" v-slot="{ navigate }">
                        <li @click="navigate">登录</li>
                    </router-link>
                    <router-link custom to="/Allin/register" v-slot="{ navigate }">
                        <li @click="navigate">注册</li>
                    </router-link>
                    <router-link custom to="/information" v-slot="{ navigate }">
                        <li @click="navigate">消息通知</li>
                    </router-link>
                </ul>

                <div>
                    <i class="iconfont icon-icon-test10"></i>
                    购物车 ({{ store.count }})
                </div>
            </div>
        </div>

    </div>
</template>
<script setup>
import useNavbar_ship from '../store/Navbar_ship'

const store = useNavbar_ship()

</script>
<style lang="scss" scoped>
* {
    margin: 0;
    padding: 0;
}

#nav {
    width: 100%;
    background: #333333;

    #nav_son {
        width: 1200px;
        height: 35px;
        margin: 0 auto;
        display: flex;

        .left {
            flex: 1;
            display: flex;
            padding: 9px;

            li {
                width: auto;
                height: 20px;
                line-height: 20px;
                padding: 0 10px;
                text-align: center;
                font-size: 12px;
                list-style: none;
                border-right: 0.5px solid #b0b0b0;
                color: #b0b0b0;
                cursor: pointer;
            }

            li:last-of-type {
                border-right: none;
            }

            li:hover {
                color: white;
            }

        }

        .right {
            flex: 1;
            display: flex;
            justify-content: flex-end;

            ul {
                display: flex;
                padding: 9px;

                li {
                    width: auto;
                    height: 20px;
                    line-height: 20px;
                    padding: 0 10px;
                    text-align: center;
                    font-size: 12px;
                    list-style: none;
                    border-right: 0.5px solid #b0b0b0;
                    color: #b0b0b0;
                    cursor: pointer;
                }

                li:last-of-type {
                    border-right: none;
                }

                li:hover {
                    color: white;
                }

            }

            div {
                width: 100px;
                height: 35px;
                text-align: center;
                line-height: 35px;
                font-size: 12px;
                color: #b0b0b0;
                background-color: #424242;
                cursor: pointer;

                i {
                    color: #b0b0b0;
                }
            }
        }
    }

}
</style>